package acwing;

import java.io.*;
import java.util.*;

public class ac869 {
    static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));
    static int n;

    static int cin() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    static ArrayList<Integer> get_divisors(int x) {
        ArrayList<Integer> res = new ArrayList<>();
        for (int i = 1; i <= x / i; i ++ ) {
            if (x % i == 0) {
                res.add(i);
                if (i != x / i) res.add(x / i);
            }
        }
        res.sort(Comparator.comparingInt(o -> o));
        return res;
    }

    public static void main(String[] args) throws IOException {
        n = cin();
        while (n -- > 0) {
            int x = cin();
            ArrayList<Integer> divisors = get_divisors(x);
            for (int i = 0; i < divisors.size(); i ++ ) {
                out.print(divisors.get(i) + " ");
            }
            out.println();
        }
        out.close();
    }
}